<?php

/**
 * Catalog form base class.
 *
 * @method Catalog getObject() Returns the current form's model object
 *
 * @package    faceshop
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseCatalogForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'catalog_id'       => new sfWidgetFormInputHidden(),
      'parent_id'        => new sfWidgetFormInputText(),
      'page_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Page'), 'add_empty' => true)),
      'level_depth'      => new sfWidgetFormInputText(),
      'nleft'            => new sfWidgetFormInputText(),
      'nright'           => new sfWidgetFormInputText(),
      'position'         => new sfWidgetFormInputText(),
      'name'             => new sfWidgetFormTextarea(),
      'description'      => new sfWidgetFormTextarea(),
      'image'            => new sfWidgetFormTextarea(),
      'meta_description' => new sfWidgetFormTextarea(),
      'meta_keywords'    => new sfWidgetFormTextarea(),
      'meta_title'       => new sfWidgetFormTextarea(),
      'is_active'        => new sfWidgetFormInputCheckbox(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'catalog_id'       => new sfValidatorChoice(array('choices' => array($this->getObject()->get('catalog_id')), 'empty_value' => $this->getObject()->get('catalog_id'), 'required' => false)),
      'parent_id'        => new sfValidatorInteger(array('required' => false)),
      'page_id'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Page'), 'required' => false)),
      'level_depth'      => new sfValidatorInteger(array('required' => false)),
      'nleft'            => new sfValidatorInteger(array('required' => false)),
      'nright'           => new sfValidatorInteger(array('required' => false)),
      'position'         => new sfValidatorInteger(array('required' => false)),
      'name'             => new sfValidatorString(),
      'description'      => new sfValidatorString(array('required' => false)),
      'image'            => new sfValidatorString(array('required' => false)),
      'meta_description' => new sfValidatorString(array('required' => false)),
      'meta_keywords'    => new sfValidatorString(array('required' => false)),
      'meta_title'       => new sfValidatorString(array('required' => false)),
      'is_active'        => new sfValidatorBoolean(array('required' => false)),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('catalog[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Catalog';
  }

}
